package top.xcxdl.rural.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.xcxdl.rural.entity.RuralCourse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Ding
 * @since 2022-05-08
 */
@Mapper
public interface RuralCourseMapper extends BaseMapper<RuralCourse> {

    List<RuralCourse> getList(@Param("key") String key);

    RuralCourse getById(@Param("courseId") Integer courseId);

    List<RuralCourse> getChapterAndLessons(@Param("courseId") Integer courseId);

    List<Integer> getDelIdIgnoreThisId(@Param("courseId") Integer courseId);

    int menuItemDel(@Param("list") List<Integer> allIDs);

    List<RuralCourse> getListByUser(@Param("userId") Integer userId,@Param("key") String key);

    /**
     * 根据课程用户id获取已报课程
     * @param userId 用户id
     * @param key 搜索关键字
     * @return 实体集合
     */
    List<RuralCourse> getCourseListWhereCollected(@Param("userId") Integer userId,@Param("key") String key);

    RuralCourse getDetailByUser(@Param("courseId")Integer courseId,@Param("userId") Integer userId);

    int updateCourseUserByCourse(@Param("course") RuralCourse course);

    RuralCourse getInfo(@Param("courseId")Integer courseId);
}
